<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt"	uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>

       <%@ include file="/WEB-INF/include/meta.jsp" %>
       <%@ include file="/WEB-INF/include/css.jsp" %>

       <title></title>
        <script src="${ctx}/static/js/vendor/jquery-1.4.2.js"></script>
    <script type="text/javascript">   
  	var pageNo = Number(${pageNo}) ;
	var pageCount= Number(${pageCount});
	function search() {
		//把表单的数据进行序列化
		$.ajax({
			url:"${ctx}/teacher/showTeaBypage",
			type:"POST",
			data:{name:$("#name").val(),schoolId:$("#schoolId").val(),cellPhone:$("#cellPhone").val(),subProId:$("#subProId").val(),pageNo:pageNo},
			dataType:"json",
			success:function(page){
				
				$("#pageCount").html(page.totalPage) ;
				$("#totalCount").html(page.total) ;
				$("#pageNo").html(pageNo);
				pageCount = Number(page.totalPage);
				var data1 ="" ;
				for(var i=0;i<page.datas.length;i++){
				
					var len = page.datas[i].subProjects.length ;
					data1 += "<tr>" ;
					data1 +="<td>"+page.datas[i].uid+"</td>" ;
					data1 +="<td>"+page.datas[i].name +"</td>" ;
					data1 +="<td><a href='"+page.datas[i].school.schoolId +"/detail'>"+page.datas[i].school.schoolNAME+"</a></td>" ;
					data1 +="<td>"+page.datas[i].email+"</td>" ;
					data1 +="<td>"+page.datas[i].cellPhone+"</td>" ;
					data1 +="<td>" ;
					 for(var j=0;j<len;j++){
                        data1 += "<a href='"+page.datas[i].subProjects[j].spid+"/detail'>"+page.datas[i].subProjects[j].name+"</a><br>" ;
  					}
					data1 +="</td>" ;
					data1 +="<td>" ;
					 if(page.datas[i].identificationStatus == 0){
					  data1 += "未认证	" ;
					 }
                      if(page.datas[i].identificationStatus == 1){
					  data1 += "已认证	" ;
					 }
					  if(page.datas[i].identificationStatus == 2){
					  data1 += "认证未过	" ;
					 }              			
                    data1 += "</td>"  ;  
					data1 +="<td><a href='${ctx}/teacher/"+page.datas[i].uid+"/detail'>详情</a>&nbsp;<a onclick='{if(confirm('您确定删除此条信息吗?')){return true;}return false;}' href='${ctx}/teacher/"+page.datas[i].uid+"/delTea' >删除</a></td>" ;
  					data1 += "</tr>" ;
				}
				$("#quxiao").click() ;
				$("#shuju").html(data1) ;
			}
		});
	}
	function up(){
		if(pageNo>=pageCount){
			alert("这是最后一页") ;
			pageNo =pageCount ;
		}else{
			pageNo++ ;
			search() ;
		}
	}
	function down(){
		if(pageNo<=1){
			alert("这是第一页") ;
			pageNo =1 ;
		}else{
			pageNo--;
			search() ;
		}
	}
	function show(pageno){
		pageNo = Number(pageno) ;
		search() ;
	}
</script>

<style type="text/css"> 
.divClass { 
width: 200px; 
height: 200px; 
} 
.divImg{ 
max-height:200px; max-width:200px; 
width: expression(this.width > 200 && this.width > this.height ? 200 : auto); 
height: expression(this.height > 200 ? 200 : auto); 
} 
</style> 
</head>

  <body>
  
  	<%@ include file="/WEB-INF/include/header.jsp" %>
	
	<%@ include file="/WEB-INF/include/menu.jsp" %>
	
	<div class="container main-content">
	
	     <div class="panel panel-default arizona-panel arizona-panel-layout">
		  
	           <div class="panel-heading">
                 <ol class="breadcrumb">
                        <li><a href="${ctx}/users">用户管理</a></li>  

                  </ol>

                  </div>
		  
	     <div class="panel-body">

        <!-- ================ submenu ================ -->
        
            <div class= "col-xs-2 arizona-panel-layout-left no-horizontal-padding">
                  <%@ include file="/WEB-INF/include/submenu.jsp" %>
            </div><!--Submenu End-->
    
              
        <!-- ================ right panel ================ -->
            
            <div class="col-xs-10 arizona-panel-layout-right">

                  <div class="arizona-breadcrumb-wrapper">
                        <div class="arizona-breadcrumb clearfix">
                              <h2>
                                    <i class="glyphicon glyphicon-sort-by-attributes"  title=""></i><span> 用户管理&nbsp;-&nbsp;老师管理</span>
                              </h2>
                        </div>
                  </div>
                        
                  <div class="btn-toolbar pull-right">
                        <div class="btn-group">
                              <a class="btn btn-default btn-shadow btn-shadow-default demo2do-btn" title="添加客户" data-toggle="modal" data-target="#teacherAdd" href="/arizona/customers/create">
                               <i class="glyphicon glyphicon-plus"></i> 添加老师用户
                              </a>
                              <a class="btn btn-default btn-shadow btn-shadow-default demo2do-btn" title="过滤查询" data-toggle="modal" data-target="#userQurey" href="/arizona/customers/search">
                                    <i class="glyphicon glyphicon-search"></i> 查询
                              </a>
                        </div>
                  </div>

                  <!-- 模态框（Modal） Search -->
                  <div class="modal fade " id="userQurey" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                        <div class="modal-dialog demo2do-modal-dialog" style="width: 950px">
                              <div class="modal-content">
                                    <div class="modal-header arizona-breadcrumb no-bottom-border clearfix">
                                          <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                                          <h2>
                                                <i class="glyphicon glyphicon-search"  title="teacher search"></i><span> 用户管理&nbsp;-&nbsp;老师用户搜索</span>
                                          </h2>
                                    </div>
                                    <form class="form-horizontal" action="/arizona/customers" method="get">
                                    <div class="modal-body">
                                          <div class="form-group demo2do-form-group">
                                                <label class="col-xs-2 control-label">姓名</label>
                                                <div class="pull-left width-30-percent">
                                                      <input class="form-control" type="text" value="" id="name" name="name"></input>
                                                </div>
                                                <label class="col-xs-2 control-label">学校</label>
                                                <div class="pull-left width-30-percent">
                                                      <input class="form-control" type="text" value="" id="schoolId" name="schoolId"></input>
                                                </div>
                                          </div>
                                          <div class="form-group demo2do-form-group">
                                                <label class="col-xs-2 control-label">手机号</label>
                                                <div class="pull-left width-30-percent">
                                                      <input class="form-control" type="text" value="" id="cellPhone" name="cellPhone"></input>
                                                </div>
                                          </div>
                                          <div class="form-group demo2do-form-group">
                                                 <label class="col-xs-2 control-label">项目</label>
                                                <div class="pull-left width-30-percent">
                                                      <select class="select2 form-control select2-offscreen" name="fid" tabindex="-1" title="">
                                                           <option value="">请选择</option>
                                                            <option value="1">丝绸之路</option>
                                                            <option value="2">志愿海南</option>
                                                            <option value="3">模拟商赛</option>
                                                            <option value="4">商赛</option>
                                                            <option value="5">AAPT(国内)</option>
                                                            <option value="6">AAPT(国外)</option>
                                                            <option value="7">WYEF</option>
                                                            <option value="8">数学竞赛(国内)</option>
                                                            <option value="9">数学竞赛(国外)</option> 
                                                            <option value="10">模联</option>
                                                            <option value="11">Mini MBA</option>
                                                      </select>
                                                      
                                                </div>
                                                 <label class="col-xs-2 control-label">子项目</label>
                                                <div class="pull-left width-30-percent">
                                                      <select class="select2 form-control select2-offscreen" id="subProId" name="subProId" tabindex="-1" title="">
                                                            <option value="">请选择</option>
                                                            <option value="1">Mini MBA EU1</option>
                                                            <option value="2">数学竞赛</option>
                                                            <option value="3">AAPT</option>
                                                            <option value="4">WYEF</option>
                                                      </select>
                                                </div>
                                          </div>
                                    </div>
                                     <div class="modal-footer">
                                          <button type="button" class="btn btn-default" data-dismiss="modal" id="quxiao">取消</button>
                                          <button type="button" class="btn btn-primary" onclick="javascript:show(1)">搜索</button>
                                  	  </div>
                                    </form>
                                   
                              </div> <!-- /.modal-content -->
                        </div> <!-- /.modal dialog -->
                  </div> <!--Modal fade End-->
  					${message}
                  <div class="modal fade " id="teacherAdd" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                        <div class="modal-dialog demo2do-modal-dialog" style="width: 950px">
                              <div class="modal-content">
                                    <div class="modal-header arizona-breadcrumb no-bottom-border clearfix">
                                          <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                                          <h2>
                                                <i class="glyphicon glyphicon-plus"  title="teacher plus"></i><span> 用户管理&nbsp;-&nbsp;老师用户搜索</span>
                                          </h2>
                                    </div>
                                    <form class="form-horizontal" action="${ctx}/teacher/add"  method="post">
                                    <div class="modal-body">
                                          <div class="form-group demo2do-form-group">
                                                <label class="col-xs-2 control-label">姓名</label>
                                                <div class="pull-left width-30-percent">
                                                      <input class="form-control" type="text" value="" name="name"></input>
                                                </div>
                                                <label class="col-xs-2 control-label">学校</label>
                                                <div class="pull-left width-30-percent">
                                                      <input class="form-control" type="text" value="" name="schoolId"></input>
                                                </div>
                                          </div>
                                          <div class="form-group demo2do-form-group">
                                                <label class="col-xs-2 control-label">手机号</label>
                                                <div class="pull-left width-30-percent">
                                                      <input class="form-control" type="text" value="" name="cellPhone"></input>
                                                </div>
                                                <label class="col-xs-2 control-label">邮箱</label>
                                                <div class="pull-left width-30-percent">
                                                      <input class="form-control" type="text" value="" name="email"></input>
                                                </div>
                                          </div>
                                    </div>
                                     <div class="modal-footer">
                                          <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                                          <button type="submit" class="btn btn-primary">添加</button>
                                    </div>
                                    </form>
                                   
                              </div> <!-- /.modal-content -->
                        </div> <!-- /.modal dialog -->
                  </div> <!--Modal fade End-->
                  
                   <div class="modal fade " id="identify" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                        <div class="modal-dialog demo2do-modal-dialog" style="width: 950px">
                              <div class="modal-content">
                                    <div class="modal-header arizona-breadcrumb no-bottom-border clearfix">
                                          <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                                          <h2>
                                                <i class="glyphicon glyphicon-search"  title="teacher search"></i><span> 认证信息&nbsp;-&nbsp;</span>
                                          </h2>
                                    </div>
                                    <form class="form-horizontal" action="/arizona/customers" method="get">
                                    <div class="modal-body">
                                          <div class="form-group demo2do-form-group">
                                                <div class="divClass" style="float:left" > 
                                                	<img src="${ctx}/static/wo.jpg" class="divImg"  />
                                                </div>
                                                <div style="padding-left:10px;float:right">
                                                 <label class="col-xs-2 control-label">姓名</label>
                                                      	<p>崔泽林</p>  <br/>                                            
                                          		<label class="col-xs-2 control-label">学校</label>
                                                     	<p>北京交通大学</p><br/>    
                                                <label class="col-xs-2 control-label">手机号</label>
                                                      	<p>123123124124</p><br/>    
                                                
                                         	    <label class="col-xs-2 control-label">认证结果</label>
                                                      <select class="select2 form-control select2-offscreen" id="subProId" name="subProId" tabindex="-1" title="">
                                                            <option value="">请选择</option>
                                                            <option value="1">认证通过</option>
                                                            <option value="2">认证失败</option>
                                                      </select><br/>    
                                                 <label class="col-xs-2 control-label">返回信息</label>
                                                     <input class="form-control" type="text" value="" id="cellPhone" name="cellPhone"></input>
                                                     <br/>    
                                                 </div>
                                          </div>
                                          
                                    </div>
                                     <div class="modal-footer">
                                          <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                                          <button type="button" class="btn btn-primary" >确定</button>
                                  	  </div>
                                    </form>
                                   
                              </div> <!-- /.modal-content -->
                        </div> <!-- /.modal dialog -->
                  </div> <!--Modal fade End-->
                  
                  <table class="table table-striped table-hover demo2do-table">
                        <thead>
                              <tr>
                                    <th>Uid</th>
                                    <th>Name</th>
                                    <th>School</th>
                                    <th>Email</th>
                                    <th>Cellphone</th>
                                    <th>Project</th>
                                    <th>认证情况</th>
                                    <th>Edit</th>
                              </tr>
                             </thead>
                             <tbody  class="dele" id="shuju">
                              <c:if test="${totalCount le 0 }">
								<tr>
								<td colspan="8">目前还没有用户数据</td>
								</tr>
							</c:if>
                    <c:if test="${totalCount gt 0}">
						<c:forEach items="${list}" var="u">
							<tr>
									  <td>${u.uid }</td>
                                      <td>${u.name }</td>
                                      <td><a href="${u.school.schoolId }/detail">${u.school.schoolNAME }</a></td>
                                      <td>${u.email }</td>
                                      <td>${u.cellPhone }</td>
                                      
                                      <td>
                                      <c:forEach items="${u.subProjects}" var="pu">
                                      <a href="${pu.spid}/detail">${pu.name }</a><br>
                                      </c:forEach>
                                      </td>
                                      <td> <c:if test="${u.identificationStatus eq 0 }">
                                      			 <a class="btn btn-default btn-shadow btn-shadow-default demo2do-btn" title="过滤查询" data-toggle="modal" data-target="#identify" href="/arizona/customers/search">未认证</a>	
                                       	   </c:if>
                                       	   <c:if test="${u.identificationStatus eq 1 }">
                                      			已认证		
                                       	   </c:if>
                                       	   <c:if test="${u.identificationStatus eq 2 }">
                                      			认证未过		
                                       	   </c:if>
                                      </td>
                                      <td><a href="${ctx }/teacher/${u.uid }/detail">详情</a>&nbsp;<a onclick="{if(confirm("您确定删除此条信息吗?")){return true;}return false;}"  href="${ctx }/teacher/${u.uid }/delTea" >删除</a></td>
								</tr>
                    	</c:forEach>
					</c:if>
                        </tbody>
                        
                        <tbody>
 <table align='center' width="95%" height="41" ><tr><td >共<b><font color='FA8100' id="totalCount">${totalCount}</font>
</b>条信息&nbsp;&nbsp;<b><font color='FA8100'>${size }</font>
</b>条信息/页&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:show('1')"  style="text-decoration:none;">首页</a>
&nbsp;&nbsp;<a href="javascript:down()" style="text-decoration:none;">上一页</a>&nbsp;&nbsp;
<a href="javascript:up()"  style="text-decoration:none;">下一页</a>  
<a href="javascript:show('${pageCount } ')"  style="text-decoration:none;">尾页</a>&nbsp;&nbsp;&nbsp;&nbsp;页次：<strong><font color=FA8100 id='pageNo'>${pageNo}</font>/<font color=FA8100 id="pageCount">${pageCount }</font></strong>页
&nbsp;&nbsp;&nbsp;&nbsp;
</td></tr></table>
                        </tbody>

                  </table>
            </div><!--right panel End-->

        </div><!--Panel Body End-->

  	  </div><!--Panel layout End-->
  		
  	</div><!--Container End-->
  	
  	<%@ include file="/WEB-INF/include/footer.jsp" %>

	<%@ include file="/WEB-INF/include/script.jsp" %>
  
  </body>
  
</html>
